package homework;

import java.util.List;

public class Homework_P1M3_4_SearchStudent {
    /**
     * 查询学生对象
     * 
     * @param id 学号
     * @param listStudents
     * @return 返回学生对象或者null
     */
    public static Homework_P1M3_4_Student seachStudent(int id, List<Homework_P1M3_4_Student> listStudents) {
      	// 遍历List，返回目标
        for (Homework_P1M3_4_Student student : listStudents) {
            if (id == student.getId()) {
                return student;

            }
        }
				// 如果不存在，则返回null
        return null;

    }
}

